package com.spec.controller.system;

import org.apache.shiro.session.Session;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import sys.basic.controller.BaseController;
import sys.basic.entity.PageData;
import sys.basic.util.Jurisdiction;

/**
 * Created by hzq on 2017/5/30.
 */
@Controller
@RequestMapping(value = "/index")
public class LoginController extends BaseController{
    /**
     * 进入登陆页面
     * @return
     */
    @RequestMapping(value="/goLogin")
    public ModelAndView goLogin(){
        ModelAndView mv = this.getModelAndView();
        PageData pd = this.getPageData();
        mv.setViewName("system/index/login");
        mv.addObject("pd",pd);
        return mv;
    }

    /**
     * 验证登陆
     * @return
     */
    @RequestMapping(value="/login")
    public ModelAndView login(){
        ModelAndView mv = this.getModelAndView();
        PageData pd = this.getPageData();
        //shiro 获取session
        Session session = Jurisdiction.getSession();


        mv.setViewName("system/index/index");
        mv.addObject("pd",pd);
        return mv;
    }

    @RequestMapping(value="/goMain")
    public ModelAndView goMain(){
        ModelAndView mv = this.getModelAndView();
        PageData pd = this.getPageData();
        mv.setViewName("system/index/main");
        mv.addObject("pd",pd);
        return mv;
    }

    /**
     * 进入首页
     * @return
     */
    @RequestMapping(value="/goIndex")
    public ModelAndView goIndex(){
        ModelAndView mv = this.getModelAndView();
        PageData pd = this.getPageData();
        mv.setViewName("system/index/index");
        mv.addObject("pd",pd);
        return mv;
    }

}
